﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CheReaction : MonoBehaviour
{
	public float naohCount = 0;
	public float hclCount = 0;
	public float shiruiCount = 0;

	public Renderer waterRender;

	public void AddNaohCount()
	{
		naohCount++;
		if (shiruiCount == 0) {
			return;
		}
		CompareCount ();
	}

	public void AddHclCount()
	{
		hclCount++;
		if (shiruiCount == 0) {
			return;
		}
		CompareCount ();
	}

	public void AddShiRuiCount()
	{
		shiruiCount++;
		if (naohCount == 0 && hclCount == 0) {
			waterRender.material.color = new Color (153 / 255.0f, 50 / 255.0f, 205 / 255.0f, 1);
		} else {
			CompareCount ();
		}
	}

	public void CompareCount()
	{
		if (naohCount > hclCount) {
			waterRender.material.color = Color.blue;
		} else if (naohCount == hclCount) {
			waterRender.material.color = new Color (153 / 255.0f, 50 / 255.0f, 205 / 255.0f, 1);
		} else {
			waterRender.material.color = Color.red;
		}
	}
}

